#ifndef _TCPSERVER_H
#define _TCPSERVER_H

#include "04_Acceptor.hpp"
#include "06_EventLoop.hpp"
#include <thread>

namespace xy
{
class TcpServer
{
public:
    TcpServer(short unsigned, const std::string&);
    ~TcpServer();

    void start();
    void stop();
    bool get_is_running() const { return _is_running; }
    Event_Loop& get_event_loop() { return _event_loop; }

private:
    Acceptor    _acceptor;
    Event_Loop  _event_loop;

    std::thread _thread;        // 添加线程成员
    bool        _is_running;    // 标记服务器是否运行, AI增加的，很好
};

}

#endif
